package com.config;

import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
import com.fasterxml.jackson.databind.module.SimpleModule;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.servlet.DispatcherType;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.List;




@Configuration
public class ImageMapperConfig implements WebMvcConfigurer {

    @Value("${upload.dir}")
    private String upload;



    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        String os = System.getProperty("os.name");
        registry.addResourceHandler("/upload/**").addResourceLocations("file:" + upload);
        registry.addResourceHandler("/screen/**").addResourceLocations("file:" + upload + "screen/");
        registry.addResourceHandler("/video/**").addResourceLocations("file:" + upload + "video/");
        registry.addResourceHandler("/images/**").addResourceLocations("file:" + upload + "images/");
        registry.addResourceHandler("/apk/**").addResourceLocations("file:" + upload + "apk/").resourceChain(true);
    }
}
